home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 039a / mawk10.zip / MAWK.H < prev    next >
C/C++ Source or Header  |  1991-10-05  |  5KB  |  195 lines

  1.  
  2. /********************************************
  3. mawk.h
  4. copyright 1991, Michael D. Brennan
  5.  
  6. This is a source file for mawk, an implementation of
  7. the AWK programming language.
  8.  
  9. Mawk is distributed without warranty under the terms of
  10. the GNU General Public License, version 2, 1991.
  11. ********************************************/
  12.  
  13.  
  14. /*   $Log:    mawk.h,v $
  15.  * Revision 3.7.1.1  91/09/14  17:23:46  brennan
  16.  * VERSION 1.0
  17.  * 
  18.  * Revision 3.7  91/08/13  06:51:48  brennan
  19.  * VERSION .9994
  20.  * 
  21.  * Revision 3.6  91/07/19  07:51:19  brennan
  22.  * escape sequence now recognized in command line assignments
  23.  * 
  24.  * Revision 3.5  91/07/17  15:09:34  brennan
  25.  * moved space_split() proto to field.h
  26.  * 
  27.  * Revision 3.4  91/06/29  09:47:18  brennan
  28.  * Only track NR if needed
  29.  * 
  30.  * Revision 3.3  91/06/28  04:17:04  brennan
  31.  * VERSION 0.999
  32.  * 
  33.  * Revision 3.2  91/06/10  15:59:23  brennan
  34.  * changes for V7
  35.  * 
  36.  * Revision 3.1  91/06/07  10:27:54  brennan
  37.  * VERSION 0.995
  38.  * 
  39.  * Revision 2.7  91/06/05  07:20:26  brennan
  40.  * better error messages when regular expression compiles fail
  41.  * 
  42.  * Revision 2.6  91/06/04  06:45:58  brennan
  43.  * minor change for includes
  44.  * 
  45.  * Revision 2.5  91/05/28  15:18:02  brennan
  46.  * removed STRING_BUFF back to temp_buff.string_buff
  47.  * 
  48.  * Revision 2.4  91/05/28  09:04:59  brennan
  49.  * removed main_buff
  50.  * 
  51.  * Revision 2.3  91/05/22  07:47:57  brennan
  52.  * added strtod proto
  53.  * 
  54.  * Revision 2.2  91/05/16  12:20:00  brennan
  55.  * cleanup of machine dependencies
  56.  * 
  57.  * Revision 2.1  91/04/08  08:23:33  brennan
  58.  * VERSION 0.97
  59.  * 
  60. */
  61.  
  62.  
  63. /*  mawk.h  */
  64.  
  65. #ifndef  MAWK_H
  66. #define  MAWK_H   
  67.  
  68. #include  "config.h"
  69.  
  70. #ifdef   DEBUG
  71. #define  YYDEBUG  1
  72. extern  int   yydebug ;  /* print parse if on */
  73. extern  int   dump_RE ;
  74. #endif
  75. extern  int   dump_code ;
  76.  
  77. #include <stdio.h>
  78.  
  79. #if  HAVE_STRING_H
  80. #include <string.h>
  81. #else
  82. char *strchr() ;
  83. char *strcpy() ;
  84. char *strrchr() ;
  85. #endif
  86.  
  87. #if  HAVE_STDLIB_H
  88. #include <stdlib.h>
  89. #endif
  90.  
  91. #include "types.h"
  92.  
  93.  
  94. /*----------------
  95.  *  GLOBAL VARIABLES
  96.  *----------------*/
  97.  
  98. /* some well known cells */
  99. extern CELL cell_zero, cell_one ;
  100. extern STRING  null_str ;
  101. /* a useful scratch area */
  102. extern union tbuff temp_buff ;
  103.  
  104. /* help with casts */
  105. extern int pow2[] ;
  106.  
  107.  
  108.  /* these are used by the parser, scanner and error messages
  109.     from the compile  */
  110.  
  111. extern  int current_token ;
  112. extern  unsigned  token_lineno ; /* lineno of current token */
  113. extern  unsigned  compile_error_count ;
  114. extern  int  paren_cnt, brace_cnt ;
  115. extern  int  print_flag, getline_flag ;
  116. extern  short mawk_state ;
  117. #define EXECUTION     1  /* other state is 0 compiling */
  118.  
  119. /*---------*/
  120.  
  121. #ifndef MSDOS_MSC
  122. extern  int  errno ;     
  123. #endif
  124. extern  char *progname ; /* for error messages */
  125.  
  126. /* macro to test the type of two adjacent cells */
  127. #define TEST2(cp)  (pow2[(cp)->type]+pow2[((cp)+1)->type])
  128.  
  129. /* macro to get at the string part of a CELL */
  130. #define string(cp) ((STRING *)(cp)->ptr)
  131.  
  132. #ifdef   DEBUG
  133. #define cell_destroy(cp)  DB_cell_destroy(cp)
  134. #else
  135.  
  136. #define cell_destroy(cp)   if ( (cp)->type >= C_STRING &&\
  137.                                 -- string(cp)->ref_cnt == 0 )\
  138.                                 zfree(string(cp),string(cp)->len+5);else
  139. #endif
  140.  
  141. /*  prototypes  */
  142.  
  143. void  PROTO( cast1_to_s, (CELL *) ) ;
  144. void  PROTO( cast1_to_d, (CELL *) ) ;
  145. void  PROTO( cast2_to_s, (CELL *) ) ;
  146. void  PROTO( cast2_to_d, (CELL *) ) ;
  147. void  PROTO( cast_to_RE, (CELL *) ) ;
  148. void  PROTO( cast_for_split, (CELL *) ) ;
  149. void  PROTO( check_strnum, (CELL *) ) ;
  150. void  PROTO( cast_to_REPL, (CELL *) ) ;
  151.  
  152. int   PROTO( test, (CELL *) ) ; /* test for null non-null */
  153. CELL *PROTO( cellcpy, (CELL *, CELL *) ) ;
  154. CELL *PROTO( repl_cpy, (CELL *, CELL *) ) ;
  155. void  PROTO( DB_cell_destroy, (CELL *) ) ;
  156. void  PROTO( overflow, (char *, unsigned) ) ;
  157. void  PROTO( rt_overflow, (char *, unsigned) ) ;
  158. void  PROTO( rt_error, ( char *, ...) ) ;
  159. void  PROTO( mawk_exit, (int) ) ;
  160. void PROTO( da, (INST *, FILE *)) ;
  161. char *PROTO( str_str, (char*, char*, unsigned) ) ;
  162. char *PROTO( rm_escape, (char *) ) ;
  163. int   PROTO( re_split, (char *, PTR) ) ;
  164. char *PROTO( re_pos_match, (char *, PTR, unsigned *) ) ;
  165.  
  166. void  PROTO( exit, (int) ) ;
  167. #ifdef THINK_C
  168. #include <unix.h>
  169. #else
  170. int   PROTO( close, (int) ) ;
  171. int   PROTO( open, (char *,int, int) ) ;
  172. int   PROTO( read, (int , PTR, unsigned) ) ;
  173. char *PROTO( getenv, (const char *) ) ;
  174. #endif
  175.  
  176. int  PROTO ( parse, (void) ) ;
  177. int  PROTO ( yylex, (void) ) ;
  178. int  PROTO( yyparse, (void) ) ;
  179. void PROTO( yyerror, (char *) ) ;
  180.  
  181. void PROTO( bozo, (char *) ) ;
  182. void PROTO( errmsg , (int, char*, ...) ) ;
  183. void PROTO( compile_error, ( char *, ...) ) ;
  184.  
  185. INST *PROTO( execute, (INST *, CELL *, CELL *) ) ;
  186. char *PROTO( find_kw_str, (int) ) ;
  187.  
  188. #if ! HAVE_STDLIB_H
  189. double strtod() ;
  190. #endif
  191.  
  192. double fmod() ;
  193.  
  194. #endif  /* MAWK_H */
  195.